#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<cstring>
#include<unordered_map>
#include<unordered_set>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N = 2e5 + 10;
typedef pair<int,int> PII;
PII p[N];
int cnt[N];
int q[N];
int n,m;
int get(int i,int x,const pair<int,int>PII)
{
    int d = 0;
    for(int j = i + 1; j <= n; j++) 
    {
         if(p[i].y + x > p[j].y) d++;
    }
    return d;
}
bool cmp(const PII &a,const PII &b)
{
    return a.y < b.y;
}
void solve()
{
     
     cin >> n >> m;
     for(int i = 1; i <= n; i++) cin >> p[i].x;
     for(int i = 1; i <= n; i++) cin >> p[i].y;
     sort(p + 1, p + n + 1);
     for(int i = 1; i <= n; i++) cnt[i] = (p[i].y + p[i].x) ;
     for(int i = 1; i <= n; i++) q[i] = get(i,cnt[i],p[N]);
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t ;
    cin >> t;
    while(t--) solve();
    return 0;
}